package com.yzh.imagelibrary;

import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.yzh.library.activity.SelectImageActivity;
import com.yzh.library.config.SelectOptions;

public class MainActivity extends AppCompatActivity implements View.OnClickListener, SelectOptions.Callback {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.bt_selectImage).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        SelectImageActivity.show(this, new SelectOptions.Builder()
                        .setCallback(this)
                        .setHasCam(true)
                        .setSelectCount(10)
                        .build(),
                Color.BLUE
        );
    }

    @Override
    public void doSelected(String[] images) {
        String value = "";
        if (images != null) {
            for (int i = images.length - 1; i >= 0; i--) {
                value = value + images[i] + "\r\n";
            }
        }
        ((TextView) findViewById(R.id.result)).setText(value);
    }
}
